package com.dyz.LeetCodeforSwordFingerOffer;

import java.util.Stack;

public class CQueue09 {
    private Stack<Integer> stack1 = new Stack<>(); //主栈
    private Stack<Integer> stack2 = new Stack<>(); //辅助栈

    public CQueue09() {

    }
    //插入
    public void appendTail(int value) {
        if(stack1.isEmpty()){
            stack1.push(value);
        }else {
            while (!stack1.isEmpty()){
                stack2.push(stack1.pop());
            }
            stack1.push(value);
            while (!stack2.isEmpty()){
                stack1.push(stack2.pop());
            }
        }

    }

    public int deleteHead() {
        if(!stack1.isEmpty()){
            return stack1.pop();
        }

        return -1;

    }
}
